Rename file to another drive

I have a small question on the DXL script that archives my DOORS database. We have too little space left to hold a number of reasonable copies of the archives, which means that the archiving is failing after about 3 weeks. I have added extra memory to our DOORS server, which now contains another drive on the server (Z: drive).

I need to change the script to move the old archives to this drive, but I am struggling what to change in the DXL script, as I don't see a straight renaming command. Can you help?

Please see the relevant part in the script below.

/***************************************************************************************

 renameOldArchives

***************************************************************************************/

void renameOldArchives( string filePath ) {

 

                addToReport( "---Rename old archives---\n")

                Stat archiveFileStatus

                const int twoWeeks = 14 * 24 * 60 * 60

                Date expiredDate = dateOf( intOf( today ) - twoWeeks )

                addToReport( "Expired date is " expiredDate ".\n")

//            print expiredDate

                string thisFileName

                Regexp rTag = regexp "_(OLD|BASE|MONTH)"

                Regexp rProject = regexp replaceSpace(projectName)

                for thisFileName in directory filePath do {

                                if (! rProject thisFileName ) { continue }

                                if (thisFileName == "." or thisFileName == ".."){continue}

//                            print thisFileName

                                archiveFileStatus = create filePath thisFileName

                                Date fileModifiedDate = modified( archiveFileStatus )

                                if ( fileModifiedDate < expiredDate ) {

                                                if (! rTag thisFileName ) {

                                                                int ext = length(thisFileName)-4

                                                                string errmsg = renameFile( filePath thisFileName, filePath thisFileName[0:ext-1] "_OLD" thisFileName[ext:length(thisFileName)-1] )

                                                                if ( !null(errmsg) ) {

                                                                                addToReport( "Rename archive failed. " errmsg ".\n")

                                                                } else {

                                                                                addToReport( "Archive file renamed. " thisFileName " renamed " thisFileName[0:ext-1] "_OLD" thisFileName[ext:length(thisFileName)-1] ".\n")

                                                                }

                //                                            print " old\n"

                                                }

                                }

                delete archiveFileStatus

                }


AlieHagedoorn - Sat Jul 20 08:13:15 EDT 2013

Re: Rename file to another drive
Mike.Scharnow - Sun Jul 21 03:32:45 EDT 2013

it's the renameFile in

string errmsg = renameFile( filePath thisFileName, filePath thisFileName[0:ext-1] "_OLD" thisFileName[ext:length(thisFileName)-1] )

 

 

renameFile

Declaration

string renameFile(string 
old, string 
new) 

Operation

Renames the file called old to new. If the operation succeeds, returns null; if it fails, returns an error message